{#**
 * 2007-2020 PrestaShop SA and Contributors
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2020 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}

<table class="table">
  <tbody>
    {% for status in orderForViewing.history.statuses %}
    <tr>
      <td>
        <span class="badge rounded badge-print-light"
              style="background-color: {{ status.color }}; color: {{ is_color_bright(status.color) ? 'black' : 'white' }};"
        >
          {{ status.name }}
        </span>
      </td>
      <td class="text-right">
        {% if status.employeeLastName is not empty %}
          {{ status.employeeFirstName ~ ' ' ~ status.employeeLastName }}
        {% endif %}
      </td>
      <td class="text-right">
        {{ status.createdAt|date_format_full }}
      </td>
      <td class="text-right">
        {% if status.withEmail %}
          <form method="post" action="{{ path('admin_orders_resend_email', {'orderId': orderForViewing.id, 'orderHistoryId': status.orderHistoryId, 'orderStatusId': status.orderStatusId}) }}">
            <button class="btn btn-link pt-0 pb-0">
              {{ 'Resend email'|trans({}, 'Admin.Orderscustomers.Feature') }}
            </button>
          </form>
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>

<div class="row">
  <div class="col-sm-6 offset-sm-6">
    {{ form_start(updateOrderStatusForm, {'action': path('admin_orders_update_status',  {'orderId': orderForViewing.id}), 'attr': {'class': 'card-details-form'}, }) }}
      <div class="input-group card-details-actions">
        {{ form_widget(updateOrderStatusForm.new_order_status_id) }}

        <button class="btn btn-primary ml-3">
          {{ 'Update status'|trans({}, 'Admin.Orderscustomers.Feature') }}
        </button>
      </div>

      <div class="d-none">
        {{ form_rest(updateOrderStatusForm) }}
      </div>
    {{ form_end(updateOrderStatusForm) }}
  </div>
</div>
